﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Model;
using BLL;

namespace EstateappraisalApi.Controllers
{
    /// <summary>
    /// 审核
    /// </summary>
    public class AuditingController : ApiController
    {
        Basic_InfoBLL bll = new Basic_InfoBLL();
        AuditingBLL abll = new AuditingBLL();

        // GET api/auditing
        public IEnumerable<Basic_Info> Get()
        {
            return bll.ShowBasic_Info();
        }

        // GET api/auditing/5
        /// <summary>
        /// 查询对应项目的审核信息
        /// </summary>
        /// <param name="projectNumber"></param>
        /// <returns></returns>
        public List<Auditing> Get(int projectNumber)
        {
            return abll.ShowAuditing(projectNumber);            
        }

        // POST api/auditing
        /// <summary>
        /// 添加审核信息
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public int Post([FromBody]Auditing m)
        {
            m.auditing_CreateTime = DateTime.Now;
            m.auditing_Time = DateTime.Now;
            if(abll.AddAuditing(m))
            {
                return 1;
            }
            else
            {
                return 0;
            }

        }

        // PUT api/auditing/5
        /// <summary>
        /// 修改项目状态
        /// </summary>
        /// <param name="Blist"></param>
        /// <returns></returns>
        public int Put([FromBody]Basic_Info m)
        {
            if (bll.UptSBasic_Info(m))
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }

        // DELETE api/auditing/5
        public void Delete(int id)
        {
        }
    }
}
